package com.world.rickcloudendpoint.message;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @description: 网络消息头
 * @author: jlsong
 * @date: 2021/12/22 20:19:24
 * @version: 1.0
 * <p>
 * 网络消息头
 * 魔法头：short | 版本号：byte | 长度：int | 协议命令号：short | 唯一序列号
 * </p>
 */
@Data
@ApiModel(value = "netMessageHead", description = "网络消息头")
public class NetMessageHead {
    public static final short MESSAGE_HEADER_FLAG = 0x2425;

    @ApiModelProperty("魔法头[short:2]")
    private short head;

    @ApiModelProperty("版本号[byte:1]")
    private byte version;

    @ApiModelProperty("长度[unsigned long:4]")
    private int length;

    @ApiModelProperty("命令[short:2]")
    private short cmd;

    @ApiModelProperty("序列号[unsigned long:4]")
    private int serial;

    public NetMessageHead() {
        this.head = MESSAGE_HEADER_FLAG;
    }

}
